<template>
    <div id="top-header">
        <div class="time">
            <div class="time-left">
                <img alt="" src="/img/slices/time@2x.png"/>
            </div>
            <div class="time-right">{{ currentTime }}</div>
        </div>
    </div>
</template>

<script>
import {getCurrentTime2} from "@/utils/loadPage";

export default {
    name: 'MyTopHeader',

    data() {
        return {
            currentTime:'',
            timer: null
        }
    },
    mounted() {
        this.updateTime();
        this.timer = setInterval(this.updateTime, 1000);
    },
    beforeDestroy() {
        clearInterval(this.timer);
    },
    methods: {
        updateTime() {
            this.currentTime =  getCurrentTime2(false)
        }
    }
}
</script>

<style lang="scss">
#top-header {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: right;
    align-items: center;
    right: 1%;
    flex-shrink: 0;

    .time {
        width: 13%;
        height: 50%;
        box-sizing: border-box;
        //border: #1ab394 solid 1px;

        display: flex;
        justify-content: space-between;
        align-items: center;

        .time-left {
            flex: 1;
            display: flex;
            align-items: center;

            img {
                width: 65%;
            }
        }


        .time-right {
            color: #FFFFFF;
            font-size: 17px;
            flex: 7;
        }

    }

}
</style>
